import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_project/common/route_page/route_name.dart';
import 'package:flutter_project/config/theme_color.dart';
import 'package:get/get.dart';
import 'common/route_page/route_page.dart';
import 'common/utils/locations/locallizations_delegate.dart';
import 'generated/l10n.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      localizationsDelegates: [
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
        ASLocalizationsDelegate.delegate,
        S.delegate
      ],
      navigatorKey: RouteNames.navigatorKey,
      title: '星河画语',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: ThemeColor.mainColor),
        appBarTheme: AppBarTheme.of(context).copyWith(
          backgroundColor: ThemeColor.mainColor,
        ),
        useMaterial3: true,
      ),
      supportedLocales: S.delegate.supportedLocales,
      initialRoute: RouteNames.initialPage,
      onGenerateRoute: generateRoutes,
      builder: EasyLoading.init(),
    );
  }
}
